///////////////////////////////////////////////////////////
//  IGameApplication.h
//  Implementation of the Interface IGameApplication
//  Created on:      11-Jan-2015 4:13:27 PM
//  Original author: Eng. Ahmed Yasser
///////////////////////////////////////////////////////////

#if !defined(EA_AEEDB5E2_2334_4e0f_B155_692697024613__INCLUDED_)
#define EA_AEEDB5E2_2334_4e0f_B155_692697024613__INCLUDED_

#include <Windows.h>
#include <string>

class IGameApplicationObserver;

namespace EngineGame
{
	namespace EngineCore
	{
		/**
		 * Contains definitions of the basic operations in the game application, any game
		 * application must implement this interface to enable processing game application.
		 * 
		 * @author Eng. Ahmed Yasser
		 * @version 1.0
		 * @updated 12-Jan-2015 12:01:55 PM
		 */
		class IGameApplication
		{

		public:
			IGameApplication() {

			}

			virtual ~IGameApplication() {

			}

			IGameApplication(const IGameApplication& theIGameApplication) {

			}

			/**
			 * Add a new game application observer to observe the game application events
			 * 
			 * @param gameApplicationObserver    The game application observer to be added
			 */
			virtual void addGameApplicationObserver(IGameApplicationObserver* gameApplicationObserver) =0;
			/**
			 * Clear the list of the game application observers
			 */
			virtual void clearGameAppplicationObservers() =0;
			/**
			 * In this function, the caller will write any code related to the input handling
			 * from user
			 */
			virtual void handleInput() =0;
			/**
			 * Initialize the game resources and load required data for running the game
			 * 
			 * @param hInstance    The handle of the application
			 * @param gameTitle    The title of the game
			 * @param windowWidth    The width of the window that will hold the game
			 * @param windowHeight    The height of the window that will hold the game
			 */
			virtual bool initGame(HINSTANCE hInstance, std::string gameTitle = "Game Application", int windowWidth = 800, int windowHeight = 600) =0;
			/**
			 * The caller implement this function to init his own game resources
			 */
			virtual void onInit() =0;
			/**
			 * Contains any rendering code in the application, any inherited class needs to
			 * render drawing must reimplement this function
			 */
			virtual void onRender() =0;
			/**
			 * In this function, any updates to the data or entities in the game will be
			 * handled here
			 * 
			 * @param elapsedTime    The elapsed time from the last time this function called
			 */
			virtual void onUpdate(double elapsedTime) =0;
			/**
			 * Remove the game application observer from the observers list
			 * 
			 * @param gameApplicationObserver    The game application observer to be removed
			 */
			virtual void removeGameApplicationObserver(IGameApplicationObserver* gameApplicationObserver) =0;
			/**
			 * Start running the game loop
			 */
			virtual void runGame() =0;
			/**
			 * Shutdown the game and finalize any resources in the game
			 */
			virtual void shutdownGame() =0;

		};

	}

}
#endif // !defined(EA_AEEDB5E2_2334_4e0f_B155_692697024613__INCLUDED_)
